package tests;

import static org.junit.Assert.*;

import org.junit.Test;

import entities.Inventory;
import fields.Fleet;
import fields.LaborCamp;

public class TestInventory {

	// Checks if the method gets the correct number of fleets
	@Test
	public void testGetNumberOfFleets() {
		Inventory inv = new Inventory(200);
		Fleet f = new Fleet("Fleet", 200);
		Fleet f2 = new Fleet("Fleet", 200);
		LaborCamp l = new LaborCamp("LaborCamp", 200, 200);

		// First test
		assertEquals(0, inv.getNumberOfFleets());

		// Second test
		inv.addField(f);
		assertEquals(1, inv.getNumberOfFleets());

		// Third test
		inv.addField(l);
		assertEquals(1, inv.getNumberOfFleets());

		// Fourth test
		inv.addField(f2);
		assertEquals(2, inv.getNumberOfFleets());
	}

	// Checks if the method gets the correct number of fleets
	@Test
	public void testGetNumberOfLaborCamps() {
		Inventory inv = new Inventory(200);
		LaborCamp l = new LaborCamp("LaborCamp", 200, 200);
		Fleet f = new Fleet("Fleet", 200);

		// First test
		assertEquals(0, inv.getNumberOfLaborCamps());

		// Second test
		inv.addField(l);
		assertEquals(1, inv.getNumberOfLaborCamps());

		// Third test
		inv.addField(f);
		assertEquals(1, inv.getNumberOfFleets());
	}

	@Test
	public void testGetTotalAssets() {
		Inventory inv = new Inventory(200);
		LaborCamp l = new LaborCamp("LaborCamp", 200, 500);
		Fleet f = new Fleet("Fleet", 500);
		Fleet f2 = new Fleet("Fleet", 1000);

		inv.addField(l);
		inv.addField(f);
		inv.addField(f2);

		assertEquals(2200, inv.getTotalAssets());
	}

	@Test
	public void testGetOwnedFields() {
		Inventory inv = new Inventory(200);
		Fleet f = new Fleet("Fleet", 200);
		
		//First test
		assertEquals(0, inv.getOwnedFields().size());

		//Second test
		inv.addField(f);
		assertEquals(1, inv.getOwnedFields().size());

	}
}
